package cn.zn.flow.entity;

import cn.hutool.json.JSONArray;
import cn.zn.base.bean.entity.BaseEntity;
import cn.zn.user.entity.SysUser;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 审批流程
 * </p>
 *
 * @author zn-admin
 * @since 2021-06-28
 */
@TableName("T_FLOW")
public class Flow extends BaseEntity<Flow> {

    /**
     * 流水号
     */
    @TableField("FLOW_SN")
    private String flowSn;

    /**
     * 标题
     */
    @TableField("TITLE")
    private String title;

    /**
     * 发起人工号
     */
    @TableField("BEGIN_USER_CODE")
    private String beginUserCode;

    /**
     * 发起人姓名
     */
    @TableField("BEGIN_USER_NAME")
    private String beginUserName;

    /**
     * 当前步骤
     */
    @TableField("NOW_ORDERS")
    private Integer nowOrders;

    /**
     * 最大步骤
     */
    @TableField("MAX_ORDERS")
    private Integer maxOrders;

    /**
     * 对应的表
     */
    @TableField("MAIN_TABLE")
    private String mainTable;

    /**
     * 流程
     */
    @TableField("FLOW_JSON")
    private String flowJson;

    /**
     * 发起时间
     */
    @TableField("BEGIN_TIME")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date beginTime;

    /**
     * 流程结束时间
     */
    @TableField("END_TIME")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date endTime;

    /**
     * 流程是否完结：0：办理中；1：办理完毕
     */
    @TableField("STATUS")
    private String status;

    /**
     * 删除标记：0：可用； 1：删除
     */
    @TableField("IS_DEL")
    private String isDel;

    @TableField(exist = false)
    private JSONArray flowNodes;

    @TableField(exist = false)
    private List<FlowNode> approvalIdeas;

    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date receiveTime;

    @TableField(exist = false)
    private String approverCode;

    @TableField(exist = false)
    private String approverName;

    @TableField(exist = false)
    private Integer orders;

    @TableField(exist = false)
    private String flowView;

    @TableField(exist = false)
    private SysUser beginUser;

    public String getFlowSn() {
        return flowSn;
    }

    public void setFlowSn(String flowSn) {
        this.flowSn = flowSn;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getBeginUserCode() {
        return beginUserCode;
    }

    public void setBeginUserCode(String beginUserCode) {
        this.beginUserCode = beginUserCode;
    }

    public String getBeginUserName() {
        return beginUserName;
    }

    public void setBeginUserName(String beginUserName) {
        this.beginUserName = beginUserName;
    }

    public Integer getNowOrders() {
        return nowOrders;
    }

    public void setNowOrders(Integer nowOrders) {
        this.nowOrders = nowOrders;
    }

    public Integer getMaxOrders() {
        return maxOrders;
    }

    public void setMaxOrders(Integer maxOrders) {
        this.maxOrders = maxOrders;
    }

    public String getMainTable() {
        return mainTable;
    }

    public void setMainTable(String mainTable) {
        this.mainTable = mainTable;
    }

    public String getFlowJson() {
        return flowJson;
    }

    public void setFlowJson(String flowJson) {
        this.flowJson = flowJson;
    }

    public Date getBeginTime() {
        return beginTime;
    }

    public void setBeginTime(Date beginTime) {
        this.beginTime = beginTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getIsDel() {
        return isDel;
    }

    public void setIsDel(String isDel) {
        this.isDel = isDel;
    }

    public JSONArray getFlowNodes() {
        return flowNodes;
    }

    public void setFlowNodes(JSONArray flowNodes) {
        this.flowNodes = flowNodes;
    }

    public List<FlowNode> getApprovalIdeas() {
        return approvalIdeas;
    }

    public void setApprovalIdeas(List<FlowNode> approvalIdeas) {
        this.approvalIdeas = approvalIdeas;
    }

    public Date getReceiveTime() {
        return receiveTime;
    }

    public void setReceiveTime(Date receiveTime) {
        this.receiveTime = receiveTime;
    }

    public String getApproverCode() {
        return approverCode;
    }

    public void setApproverCode(String approverCode) {
        this.approverCode = approverCode;
    }

    public String getApproverName() {
        return approverName;
    }

    public void setApproverName(String approverName) {
        this.approverName = approverName;
    }

    public Integer getOrders() {
        return orders;
    }

    public void setOrders(Integer orders) {
        this.orders = orders;
    }

    public String getFlowView() {
        return flowView;
    }

    public void setFlowView(String flowView) {
        this.flowView = flowView;
    }

    public SysUser getBeginUser() {
        return beginUser;
    }

    public void setBeginUser(SysUser beginUser) {
        this.beginUser = beginUser;
    }

    @Override
    public String toString() {
        return "Flow{" +
                "flowSn=" + flowSn +
                ", title=" + title +
                ", beginUserCode=" + beginUserCode +
                ", beginUserName=" + beginUserName +
                ", nowOrders=" + nowOrders +
                ", maxOrders=" + maxOrders +
                ", mainTable=" + mainTable +
                ", flowJson=" + flowJson +
                ", beginTime=" + beginTime +
                ", endTime=" + endTime +
                ", status=" + status +
                "}";
    }
}
